<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Utiles
 *
 * @author Nero
 */
class Utiles {

    public static function formatDate($date) {
        if ($date) {
            $array = explode('/', $date);
            $new_date[0] = $array[1];
            $new_date[1] = $array[0];
            if (isset($array[2]))
                $new_date[2] = $array[2];

            $new_date = implode('/', $new_date);
        }
        return $new_date;
    }
    
    public static function multi_array_search($needle, $array){
        foreach($array as $key => $value){
            if($return = array_search($needle, $value))
                    return $return;
        }
        return false;
    }
    
    public static function getParam($name,$type='POST'){
        
        switch($type){
            case 'POST':
                $result = (isset($_POST[$name]) && $_POST[$name]) ?  $_POST[$name] : null;
                break;
            case 'GET':
                $result = (isset($_GET[$name]) && $_GET[$name]) ?  $_GET[$name] : null;
                break;
        }
        return $result;
    }

}

?>
